#!/bin/bash
# Summarizes correlation directory.
#$1 directory

function suminfo {
	
	# mirbase.
	#cat $1/*$2 | awk '{print $3}' | sort | uniq -c | sort -n -r
	cat $1/*$2 | awk '{split($9,a, "Target="); print a[2];}' | sort | uniq -c | sort -n -r 
	
	# repeats.
	#cat $1/*$2 | awk '{split($10,a,":"); sub("\"","",a[2]); print a[2];}' | sort | uniq -c | sort -n -r
	
	# gene ant.
	#cat $1/*$2 | awk '{print $13}' | sort | uniq -c | sort -n -r
	
	# gene denovo.
	#cat $1/*$2 | awk '{print $9}' | sort | uniq -c | sort -n -r
}

# Brain.
echo "brain"
suminfo $1 "brain.*.overlap.query.gff" 

echo "fibroblasts"
suminfo $1 "fibroblasts.*.overlap.query.gff" 

echo "liver"
suminfo $1 "liver.*.overlap.query.gff" 

echo "ovary_lower"
suminfo $1 "ovary_lower.*.overlap.query.gff" 

echo "cells57"
suminfo $1 "cells57.*.overlap.query.gff" 

echo "testis57"
suminfo $1 "testis57.*.overlap.query.gff" 

echo "ovary_upper"
suminfo $1 "ovary_upper.*.overlap.query.gff" 

echo "testis_lower"
suminfo $1 "testis_lower_split*.*.overlap.query.gff" 

echo "testis_upper"
suminfo $1 "testis_upper_split*.*.overlap.query.gff" 
